Handler

back to section start!

 
  We attach a unique handler name to the lister and set which commands we 
want to trap. 
 
  1handlername = 'ArcDir'handle 
  2lister set handle handler handlername quotes 
  3call openport(handlername) 
  4 
  5viewcommands = 'Read HexRead Show Play'  /* you may add other Opus commands if you wish */ 
  6notsupported = 'CopyAs Move MoveAs Rename Comment Protect' 
  7traps = 'Copy Delete MakeDir Parent Root ScanDir' viewcommands notsupported 
  8do while traps ~= '' 
  9  parse var traps trapcommand traps 
 10  dopus addtrap trapcommand handlername 
 11  end 
 12 
 13thishandle = handle 
 14lister set handle busy off 
 
Line: 
 1      We make the handler name equal to 'ArcDir' plus the handle of the 
        lister, since there can only be one lister with that handle it gives 
        a unique name. 
 2      Assign that handler to that lister, telling Opus we want quotes (") 
        surrounding every filename argument from the handler. 
 3      Enable the message port for that handler. 
 5 - 7  These are the events we'll be trapping, supported and unsupported. 
 8 - 11 Loop around, picking up one command at a time until all are done, 
        and adding the trap to the handler. 
13 - 14 Assign thishandle to the handle of our lister and make sure it's not 
        busy. 
 

DOpus PLUS - giving you that bit extra...